<%@page import="com.alibaba.dubbo.demo.bean.SysRole"%>
<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<div class="pageContent" >
<%
		SysRole role = new SysRole();
		String action = "edit";
		if(request.getParameter("action")!=null)
			action = request.getParameter("action");
		String option = "webSaveSysRole";
		if(action.equals("edit")) 
		{
			 option = "webUpdateSysRole";
			 if (request.getSession().getAttribute("sysRole") != null) {
				role = (SysRole) request.getSession().getAttribute("sysRole");
			}
		}
%> 
	<form method="post" action="<%=option%>" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone);">
		<div class="pageFormContent" layoutH="56">
			<p>
				<label>角色编码：</label>
				<input name="roleid" type="hidden" size="30" value="<%=role.getRoleid()%>"/>
				<input name="isvalid" type="hidden" size="30" value="<%=role.getIsvalid()%>"/>
				<input name="dataright" type="hidden" size="30" value="<%=role.getDataright()%>"/>
				<input name="rolecode" type="text" size="30" value="<%=role.getRolecode()%>" alt="请输入角色编码"/>
			</p>
			<p>
				<label>角色名称：</label>
				<input name="rolename" class="required" type="text" size="30" value="<%=role.getRolename()%>" alt="请输入角色名称"/>
			</p>
			<p>
				<label>权限部门ID：</label>
				<input name="orgLookup.deptrightid"  class="required" type="text" size="30" readonly="readonly" value="<%=role.getDeptrightid()%>"/>
			</p>			
			<p>
				<label>权限部门名称：</label>
				<input type="text" class="required" name="orgLookup.deptright" size="30" value="<%=role.getDeptright()%>" suggestFields="deptrightid,deptright" suggestUrl="./jsonQueryDeptInfoLookup" lookupGroup="orgLookup" />
				<a class="btnLook" href="webQueryDeptInfoByUpperDept?deptrightids=<%=role.getDeptrightid()%>" lookupGroup="orgLookup" width="600" height="400" maxable="false"  >选择权限部门</a>
			</p>
			<p>
				<label>备注：</label>
				<input name="remark" type="text" size="30" value="<%=role.getRemark()%>" />
			</p>
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>
	</form>
<script language="JavaScript">
	$(function(){
		var type = '<%=action%>';
		$("input[type=text]").each(function(i){
		    var text = $(this).val();
		    if(text =="null"){
		       $(this).val("")
		    }
		});
		//$('#deptright').attr('readonly','readonly');
		if(type=='edit')
		{
			console.info('type==edit');
			$('#rolecode').attr('readonly','readonly');
			$('#rolecode').attr('disabled','true');
		}
		else
		{
			console.info('type!=edit');
			$('#rolecode').removeAttr('readonly');
			$('#rolecode').removeAttr('disabled');
		}
	});
	console.info('<%=action%>');
</script>
</div>
